<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        if (navigator.share) {
            navigator.share({
                title: '分享标题',
                text: '分享内容',
                url: 'https://example.com',
                files: [
                    new File(['分享内容'], '分享文件.txt', { type: 'text/plain' })
                ]
            }).then(() => {
                console.log('分享成功');
            }).catch((error) => {
                console.log('分享失败', error);
            });
        }
    </script>
</body>
</html>